<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
	<h4 class="modal-title" id="exampleModalLabel">
			${empty vo?'新增':'编辑'}资料
	</h4>
</div>
<form id="saveForm" class="form-horizontal" method="post"
	  action="${pageContext.request.contextPath}/sys/user/save.do">
	<div class="modal-body">
		<input type="hidden" id="id" value="${vo.id}" name="id"/>
		<div class="row form-group">
			<div class="col-md-3 control-label">
				<label>用户名</label>
			</div>
			<div class="col-md-6 controls">
				<input type="text" id="userName" name="userName" class="form-control inputStart" value="${vo.userName}"/>
			</div>
		</div>
		<div class="row form-group">
			<div class="col-md-3 control-label">
				<label>姓名</label>
			</div>
			<div class="col-md-6 controls">
				<input type="text" id="trueName" name="trueName" class="form-control inputStart" value="${vo.trueName}"/>
			</div>
		</div>
	</div>

	<div class="modal-footer">
		<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
		<button type="submit" class="btn btn-primary">确认</button>
	</div>
</form>

<script type="text/javascript"
		src="${pageContext.request.contextPath}/assets/js-lib/bootstrap-Validation/dist/js/bootstrapValidator.js" charset="UTF-8"></script>
<script type="text/javascript">


    $('#saveForm').bootstrapValidator({
        //        live: 'disabled',
        message: '值不合法',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            userName: {
                validators: {
                    notEmpty: {
                        message: '不能为空'
                    },
                    remote : {
                        type : 'POST',
                        message : '编号已经存在！',
                        url:'${pageContext.request.contextPath}/sys/user/check.do?id=${vo.id}',
                        delay:800
                    }
                }
            },
            trueName: {
                validators: {
                    notEmpty: {
                        message: '不能为空'
                    }
                }
            }
        }
    });



</script>
